package com.dc.enums;

/**
 * @description: TODO 通知消息分类
 * @date: 2022/11/09 10:13
 * @author: zhang
 **/
public enum WebSocketMessage {

    /**
     * 报警信息
     */
    ALARM_MESSAGE(4, "{\"type\":\"4\",\"message\":%s}"),

    /**
     * 故障信息
     */
    FAULT_MESSAGE(1, "{\"type\":\"1\",\"message\":%s}"),

    /**
     * 其他信息
     */
    OTHER_MESSAGE(6, "{\"type\":\"6\",\"message\":\"%s\"}");

    private int code;

    private String content;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    WebSocketMessage(int code, String content) {
        this.code = code;
        this.content = content;
    }

    public static String getComments(int code) {
        for (WebSocketMessage value : values()) {
            if (value.code == code) {
                return value.content;
            }
        }
        return null;
    }


}
